/////////////////////////////////////////////////////////////////////////
// All rights reserved
//
// Use and distribute freely, except: don't remove my name from the
// source or documentation (don't take credit for my work), mark your
// changes and extend the author list below, don't alter or remove this notice.
//
// Send bug reports, bug fixes, enhancements, requests, etc.,
// and I'll try to keep a version up to date.
// xiezheheng@yahoo.com
//
// Author list: Zheheng XIE
//
/////////////////////////////////////////////////////////////////////////


#include "stdafx.h"
#include "gr_rrdlattribcurvestippleopengl.h"
#include <gl\gl.h>
#include "gr_dlattribcurvestipple.h"

GR_RRDLAttribCurveStippleOpenGL::GR_RRDLAttribCurveStippleOpenGL(GR_DLAttribCurveStipple* pDLAttribCurveStipple)
:m_pDLAttribCurveStipple(pDLAttribCurveStipple)
{
}

GR_RRDLAttribCurveStippleOpenGL::~GR_RRDLAttribCurveStippleOpenGL(void)
{
}

// Apply this attribute
// virtual
bool GR_RRDLAttribCurveStippleOpenGL::Apply(bool bApply)
{
	if(bApply)
	{
		int iFactor;
		unsigned short nPattern;
		m_pDLAttribCurveStipple->Get(iFactor, nPattern);
		::glPushAttrib(GL_LINE_BIT);
		::glLineStipple(iFactor, nPattern);
	}
	else
		::glPopAttrib();
	return true;
}